﻿using Dapper;
using DomainService.Service.Sys;
using Infrastructure.DataBaseConnect;
using Infrastructure.IRepository.Sys;
using Model.DomainModel.Sys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.Repository.Sys
{
    /// <summary>
    /// 数据规则配置仓储接口
    /// </summary>
    public class SysDataRuleConfigRepository : Repository<SysDataRuleConfig>, ISysDataRuleConfigRepository
    {
        /// <summary>
        /// 根据菜单id，获取数据列
        /// </summary>
        /// <param name="menuId">菜单id</param>
        /// <returns>返回对应列集合</returns>
        public List<SysDataRuleConfig> GetSysDataRuleConfig(string menuId)
        {
            string sql = @" select  *  from  Sys_DataRuleConfig 
                            where MenuId = @MenuId ";
            using var connection = DataBaseConnectConfig.GetSqlConnection();
            return connection.Query<SysDataRuleConfig>(sql, new { MenuId = menuId }).ToList();
        }
    }
}
